﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using CSUtils;
namespace CSUtils {
    /// <summary>
    /// 扩展-延时
    /// </summary>
    public class CDelayMain: CDelay0<CDelayMain> {
        const string _tag = "CSUtils.CDelayMain.线程";

        public static void Init() {
            _tag0 = "CSUtils.CDelay0.Main";
            CDelayMain.SetThreadId(Thread.CurrentThread.ManagedThreadId);
        }

        static float lastTime;

        public static void FixedUpdate() {
            if(CTime.realtimeSinceStartup - lastTime < 0.018f) {
                return;
            }
            lastTime = CTime.realtimeSinceStartup;
            CDelayMain.IUpdate(_tag);

            #if CDelayMainTest
            CLog.i(_tag, $"前台执行.....IUpdate().......real={CTime.realtimeSinceStartup}/{CTime.frameCount}..", false);
            CDelayBg.IUpdate(_tag);
            CDelayBg2.IUpdate(_tag);
            CDelayBg3.IUpdate(_tag);
            #endif
        }
    }
}
